<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport"
        content="width=device-width, initial-scale=1">
  <title>派发任务页面</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="images/bee.png">

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <!-- <link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png"> -->

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
  <!-- <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png"> -->

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
  <meta name="msapplication-TileColor" content="#0e90d2">

  <link rel="stylesheet" href="assets/css/amazeui.min.css">
  <link rel="stylesheet" href="assets/css/app.css">
</head>
<body style="background: url(images/bg1.png) no-repeat;background-size: cover; background-attachment:fixed;">
  
  <!--在这里编写你的代码-->
  <!-- 页头 -->
  <header data-am-widget="header"
  class="am-header am-header-default" style="background-color: #F6B541;">
  <div class="am-header-left am-header-nav">
    <!-- <a href="#left-link">
        <span class="am-header-nav-title">
          首页
        </span>
    
          <i class="am-header-icon am-icon-home"></i>
    </a> -->
    <ul>
      <a href="yfpage.html">
        <li style="display: flex;flex-direction: row;width: 200px;">
            <img src="images/shouye.png" alt="管理员联系方式" style="width: 150px; height: 22px;margin-top: 10px; margin-left: -10%;">
            <!-- <p style="color: #000; margin-top: 0;font-size: 16px;">小蜜蜂图片收集网</p> -->
        </li>
      </a>
    </ul>
    </div>
    
  
    <div class="am-header-right am-header-nav">
      <a href="jobfachu.html">
        <div style="display: flex;flex-direction: column;margin-left: -40px;">
          <img src="images/rw.png" alt="管理员联系方式" style="width: 30px; height: 25px;">
          <span style="color: black; font-weight: 700; font-size: 12px;margin-left: -48px; margin-top: -14px;" onclick="rw()">任务</span>
        </div>
      </a>
      <a href="personal.html">
        <div style="display: flex;flex-direction: column;margin-left: -10px;">
          <img src="images/xr.png" alt="管理员联系方式" style="width: 25px; height: 20px;">
          <span style="color: black; font-weight: 700; font-size: 12px;margin-left: -18px; margin-top: -14px;" onclick="per()">我的</span>
        </div>
      </a>
    </div>

  </header>


  <div class="am-container" style="background-color: rgba(241, 246, 249, 0.65); margin-top: 60px; 
   box-shadow: 5px 5px 5px rgba(0,0,0,0.1); border-radius: 5px; ">

  <div class="am-g am-g-fixed" style="margin-top: 4vh;">
    <div class="am-u-sm-5 am-u-sm-centered" style="text-align: center; height: 40px; font-size:xx-large; 
    font-family: SimHei; font-weight: 700; color: #E87B17;">任务卡片</div>
    
  </div>


  <div class="am-g am-g-fixed" style="margin-top: 3.5vh;">
    <div class="am-u-sm-2 am-u-sm-offset-1" style="height: 30px; font-size:large; font-family: SimHei; font-weight: 700;">图片标签：</div>
    <div class="am-u-sm-2 am-u-end">
        <div class="am-form-group" >
            <!-- <select id="doc-select-1" style="border-radius: 10px;width: 15vw;height: 36px; font-size: small; border-color: #000;">
              <option value="none" selected disabled hidden>请选择选项</option>
              <option index="option1">象</option>
              <option index="option2">猫</option>
              <option index="option3">狗</option>
            </select> -->
            <input type="text" class="" id="doc-select-1" placeholder="请输入标签" style="border-radius: 10px;width: 15vw;height: 36px; font-size: small;">
            <span class="am-form-caret"></span>
        </div>
    </div>
  </div>

  <div class="am-g am-g-fixed" style="margin-top: 1vh;">
    <div class="am-u-sm-2 am-u-sm-offset-1" style="height: 30px; font-size:large; font-family: SimHei; font-weight: 700;">截止日期：</div>
    <div class="am-u-sm-3 am-u-end">
      <div class="am-input-group am-datepicker-date" data-am-datepicker="{format: 'yyyy-mm-dd', viewMode: 'years'}" style="width: 15vw;">
        <input type="text" id="dateselect"  class="am-form-field" placeholder="请设置日期" readonly>
        <span class="am-input-group-btn am-datepicker-add-on">
          <button class="am-btn am-btn-default" type="button"><span class="am-icon-calendar"></span> </button>
        </span>
      </div>

    </div>
  </div>

  <div class="am-g am-g-fixed" style="margin-top: 2.5vh;">
    <div class="am-u-sm-2 am-u-sm-offset-1" style="height: 30px; font-size:large; font-family: SimHei; font-weight: 700;">联系方式：</div>
    <div class="am-u-sm-3 am-u-end" style="height: 30px; font-size:x-large;">
      <input type="text" class="" id="shouji" placeholder="邮箱、联系电话等" style="border-radius: 10px;width: 15vw;height: 36px; font-size: small;">
    </div>
  </div>

  <div class="am-g am-g-fixed" style="margin-top: 3.5vh;">
    <div class="am-u-sm-2 am-u-sm-offset-1" style="height: 30px; font-size:large; font-family: SimHei; font-weight: 700;">图片数量：</div>
    <div class="am-u-sm-3 am-u-end" style="height: 30px; font-size:x-large;">
      <input type="text" class="" id="number11" placeholder="本次任务图片限制数量" style="border-radius: 10px;width: 10vw;height: 36px; font-size: small;">
      <span style="font-size: small;">0.2元/张</span>
    </div>
  </div>

  <div class="am-g am-g-fixed" style="margin-top: 3.5vh;">
    <div class="am-u-sm-2 am-u-sm-offset-1" style="height: 15vh; font-size:large; font-family: SimHei; font-weight: 700;">详细需求描述：</div>
    <div class="am-u-sm-3 am-u-end am-form-group" style="height: 90px; font-size:large;">
        <textarea class="" rows="4" id="doc-ta-1" style="width: 40vw; border-radius: 10px;"></textarea>
    </div>
   
  </div>

  <br>
  <div class="am-g am-g-fixed" style="margin-top: 3.5vh;">
    <div class="am-u-sm-11 am-u-sm-offset-1" style="height: 30px; font-size:small; font-family: SimHei; color: #F01717;">
      温馨提示：对于需求图片的描述应当尽可能的详细，可对图片内容、拍摄设备、画面质量以及图片用途等做出适当要求，以便线下拍摄者收集图片！
    </div>
  </div>

  <div class="am-g" style="text-align: center;">
    <div class="am-u-sm-8 am-u-sm-offset-4 am-u-sm-centered" style="height: 20px; font-size:large; margin-bottom: 7vh;margin-top: 3vh;">
         <button type="button" id="pay" class="am-btn m-btn-danger am-round am-btn-warning" 
         style="background-color: #E87B17; width: 150px;outline: 0;">发布任务</button>
      </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" id="my-confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd">支付界面</div>
    <div class="am-modal-bd" id="money"></div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
      <span class="am-modal-btn" id="publishBtn" data-am-modal-confirm>支付</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" id="my-confirm1">
  <div class="am-modal-dialog">
    <div class="am-modal-hd">错误</div>
    <div class="am-modal-bd">对不起，您的余额不足</div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" id="publishBtn" data-am-modal-confirm>确定</span>
    </div>
  </div>
</div>




<!-- 页脚 -->
<footer data-am-widget="footer"
class="am-footer am-footer-default"
 data-am-footer="{  }" style="background-color: rgba(255,255,255,0) ;">
<div class="am-footer-switch">
<span class="am-footer-ysp" data-rel="mobile"
data-am-modal="{target: '#am-switch-mode'}">
云适配版
</span>
<span class="am-footer-divider"> | </span>
<a id="godesktop" data-rel="desktop" class="am-footer-desktop" href="javascript:">
电脑版
</a>
</div>
<div class="am-footer-miscs ">

<p>由 <a href="http://www.yunshipei.com/" title="诺亚方舟"
                                      target="_blank">诺亚方舟</a>
  提供技术支持</p>
<p>CopyRight©2014  AllMobilize Inc.</p>
<p>京ICP备13033158</p>
<br>
<p>NaN团队--小蜜蜂图片收集网</p>
</div>
</footer>

<div id="am-footer-modal"
class="am-modal am-modal-no-btn am-switch-mode-m am-switch-mode-m-default">
<div class="am-modal-dialog">
<div class="am-modal-hd am-modal-footer-hd">
<a href="javascript:void(0)" data-dismiss="modal" class="am-close am-close-spin " data-am-modal-close>&times;</a>
</div>
<div class="am-modal-bd">
您正在浏览的是

<span class="am-switch-mode-owner">
  云适配
</span>

<span class="am-switch-mode-slogan">
    为您当前手机订制的移动网站。
</span>
</div>
</div>
</div>



<!--[if (gte IE 9)|!(IE)]><!-->
<!-- <script src="assets/js/jquery.min.js"></script> -->
<!--<![endif]-->
<!--[if lte IE 8 ]-->
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<!--[endif]-->
<script src="assets/js/amazeui.min.js"></script>
<script>
  $(function() {
  $('#pay').on('click', function() {
        var total = document.getElementById("number11").value;
        $money=$('#money')
        $(function(){$money.empty(),$money.append('本次任务价格为'+Number(total)*0.2+'元')})
      $('#my-confirm').modal({
        relatedTarget: this,
        onConfirm: function() {
        const tag=document.getElementById("doc-select-1").value;
        const date=document.getElementById("dateselect").value;
        const contact=document.getElementById("shouji").value;
        const taskinfo=document.getElementById("doc-ta-1").value;
        const picnum=document.getElementById('number11').value;
        console.log("aaa"+tag)
        console.log(picnum)
        const xhr=new XMLHttpRequest();
        xhr.open('POST','http://localhost/createtask');
        xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        xhr.send('username='+window.sessionStorage.getItem('username')+'&tag='+tag+'&taskinfo='+taskinfo+'&endtime='+date+'&contact='+contact+'&picnum='+picnum);
        xhr.onreadystatechange=function(){
            // 判断
            if(xhr.readyState===4){
                if(xhr.status>= 200 && xhr.status<=300){
                    // 处理服务端返回的结果
                    var result = JSON.parse(xhr.responseText)
                    console.log(result)
                    console.log(result['msg'])
                    if(xhr.responseText.indexOf(true)+1)
                    {
                      window.location.href = "./jobfachu.html";  //成功创建任务之后跳转
                    }
                    else if(result['result']==false){
                      console.log('已知余额不足1')
                      if(result['msg']=='余额不足'){
                        console.log('已知余额不足2')
                        $('#my-confirm1').modal({
                          relatedTarget: this,
                          onConfirm: function() {
                          },
                        });
                      }
                    }
                }
            }
        }
        },
        // closeOnConfirm: false,
        onCancel: function() {
        }
      });
    });
});
</script>
<script>


    function yfpage(){
    window.location.href='./yfpage.html'
  }
  function rw(){
    window.location.href='./jobfachu.html'
  }

</script>
</body>
</html>